package cn.weixin.service.handle.impl;

import org.springframework.stereotype.Component;

import cn.weixin.common.msg.MsgType;
import cn.weixin.common.msg.req.InputTextMessage;
import cn.weixin.common.msg.resp.OutputMessage;
import cn.weixin.common.msg.resp.OutputTextMessage;
import cn.weixin.common.util.MessageUtil;
import cn.weixin.service.handle.MessageHandler;

/**
 * @author Han
 */
@Component(MsgType.REQ_MESSAGE_TYPE_TEXT)
public class TextMessageHandler implements MessageHandler<InputTextMessage>{

	@Override
	public OutputMessage handle(InputTextMessage inputMessage) {
		String content = inputMessage.getContent();
		if(content.startsWith("+ ")){
			
		}
		OutputTextMessage outputMessage = new OutputTextMessage();
		MessageUtil.setDefault(inputMessage, outputMessage);
		outputMessage.setMsgType(MsgType.RESP_MESSAGE_TYPE_TEXT);
		outputMessage.setContent("消息已经收到!"+inputMessage.getContent());
		return outputMessage;
		
	}

}
